{% load xadmin_tags %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
    <title>{{ site_web }}</title>
    <meta charset="utf-8">
    <link rel="shortcut icon" type="image/png" href="{% static "xadmin/img/favicon.ico" %}"/>
    <style type="text/css">
        .jump {
            width: 640px;
            height: 480px;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -158px;
            margin-left: -290px;
            text-align: center;
        }

        .jump-img {
            display: block;
            height: 200px;
            margin: 0 auto 30px;
        }

        .jump-state,
        .jump-tip {
            padding: 3px 0;
            font-size: 18px;
            text-align: center;
            letter-spacing: 2px;
        }

        .jump-state i {
            margin: 0 5px;
        }

        .state-maintenance {
            color: DodgerBlue;
        }

        .state-success {
            color: #3c8dbc;
        }

        .state-error {
            color: #dd4b39;
        }

        .jump-tip {
            color: #666;
            font-size: 16px;
        }

        #btns button {
            margin: 5px 0;
            border-radius: 0;
        }
    </style>
</head>

<body>
<div class="jump">
    <img class="jump-img" src="{% static "xadmin/img/jump.png" %}" alt="跳转中">
    {% block status %}<p class="jump-state state-success"><i class="fa fa-check"></i>操作完成</p>{% endblock %}
    <p class="jump-tip">
        {{ message }}
    </p>
    <p class="jump-tip">
        {#只有设置了等待时间，才会显示跳转#}
        {% if waitSecond %}
            页面自动
            <a href="{{ jumpUrl }}" class="history">跳转</a>
            等待时间:
            <span class="wait">{{ waitSecond }}</span> 秒
        {% endif %}
    </p>
</div>

{#只有设置了等待时间，才会进行跳转#}
{% if waitSecond %}
    {% vendor 'jquery.js' %}
    <script type="text/javascript">
        var countdown = {{ waitSecond }};
        settime();

        function settime() {
            if (countdown === 0) {
                window.location.href = $(".history").attr("href");
                return;
            } else {
                $("span.wait").text(countdown);
                countdown--;
            }

            setTimeout(function () {
                settime()
            }, 1000)
        }

        {#clearInterval(timer);#}
    </script>
{% endif %}
</body>
</html>
